<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="__EXTEND__/favicon.ico" >
    <link rel="Shortcut Icon" href="__EXTEND__/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__EXTEND__/lib/html5shiv.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="__EXTEND__/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>用户列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> <a style='color:#F37B1D' href="{{:U('Admin/Index/welcome')}}">首页</a> <span class="c-gray en">&gt;</span> 客户管理 <span class="c-gray en">&gt;</span> 用户列表
    <a class="btn btn-default radius r " id="btn-refresh" style="line-height:1.6em;margin-top:3px" href="{{:U('Admin/Users/UsersList')}}" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <form id="searchform" action="{{:U('Admin/Users/UsersList')}}" method="post">
        <div class="cl">
            用户ID:
            <input type="text" value="{{$searchs['user_id']}}" name="user_id" id="user_id" placeholder=" 请输入用户ID" style="width:100px" class="input-text">
            昵称:
            <input type="text" value="{{$searchs['nickname']}}" name="nickname" id="nickname" placeholder=" 请输入昵称" style="width:150px" class="input-text">
            真实姓名:
            <input type="text" value="{{$searchs['user_name']}}" name="user_name" id="user_name" placeholder=" 请输入真实姓名" style="width:150px" class="input-text">
            手机号:
            <input type="text" value="{{$searchs['user_phone']}}" name="user_phone" id="user_phone" placeholder=" 请输入手机号" style="width:150px" class="input-text">
            邀请人ID:
            <input type="text" value="{{$searchs['parent_id']}}" name="parent_id" id="parent_id" placeholder=" 请输入用户ID" style="width:100px" class="input-text">
            状态：
            <span class="select-box inline">
                <select name="status" class="select">
                    <option value="">全部状态</option>
                    <option value="1" <if condition="$searchs['status'] eq '1'">selected</if>>启用</option>
                    <option value="2" <if condition="$searchs['status'] eq '2'">selected</if>>禁用</option>
                </select>
            </span>
            <button type="submit" class="btn btn-warning radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 筛选</button>

        </div>
    </form>
    <form class="form form-horizontal" id="form-group-del">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="l">
                <!--<a class="btn btn-warning radius" data-title="添加"  onclick="do_full('添加','{{:U('Admin/Users/UsersAdd')}}')" href="javascript:;">-->
                    <!--<i class="Hui-iconfont">&#xe600;</i> 添加-->
                <!--</a>-->
                <!--<button type="button" class="btn btn-danger radius" id="mutil_del">-->
                    <!--<i class="Hui-iconfont">&#xe6e2;</i>删除-->
                <!--</button>-->
            </span>
            <span class="r">{{$page}}</span>
        </div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-bg  table-hover table-striped">
            <thead>
                <tr class="text-c">
                    <th width=""><input type="checkbox" name="" value=""></th>
                    <th width="">
                        <a href="{{:UField('UsersList',$sort,'user_id',$p)}}" title="点击排序" class="{{:CField($sort,'user_id')}}">ID</a>
                    </th>
                    <th width="">昵称</th>
                    <th width="">真实姓名</th>
                    <th width="">手机号</th>
                    <th width="">
                        <a href="{{:UField('UsersList',$sort,'user_balance',$p)}}" title="点击排序" class="{{:CField($sort,'user_balance')}}">可用余额</a>
                    </th>
                    <th width="">
                        <a href="{{:UField('UsersList',$sort,'invest_money',$p)}}" title="点击排序" class="{{:CField($sort,'invest_money')}}">投资金额</a>
                    </th>
                    <th width="">
                        <a href="{{:UField('UsersList',$sort,'earn_money',$p)}}" title="点击排序" class="{{:CField($sort,'earn_money')}}">收益金额</a>
                    </th>
                    <th width="">
                        <a href="{{:UField('UsersList',$sort,'frozen_money',$p)}}" title="点击排序" class="{{:CField($sort,'frozen_money')}}">冻结金额</a>
                    </th>
                    <th width="">
                        <a href="{{:UField('UsersList',$sort,'experience_money',$p)}}" title="点击排序" class="{{:CField($sort,'experience_money')}}">体验金</a>
                    </th>
                    <th width="">
                        <a href="{{:UField('UsersList',$sort,'last_login',$p)}}" title="点击排序(登录时间)" class="{{:CField($sort,'last_login')}}">注册/登录时间</a>
                    </th>
                    <th width="">[ID]邀请人</th>
                    <th width="">状态</th>
                    <th width="">操作</th>
                </tr>
            </thead>
            <tbody>
                <notempty name="lists">
                <foreach name="lists" item="list">
                    <tr class="text-c">
                        <td><input class="ids" type="checkbox" name="id[]" value="{{$list['user_id']}}" /></td>
                        <td>{{$list['user_id']}}</td>
                        <td>
                            <if condition="$list['headimg']">
                                <img src="{{$list['headimg']}}" style="width:25px;height:25px; border-radius:50%; overflow:hidden;">
                                <else/>
                                <img src="/Mapi/public/images/usericon.png" style="width:25px;height:25px; border-radius:50%; overflow:hidden;">
                            </if>
                            {{$list['nickname']}}
                        </td>
                        <td>
                            <if condition='$list.is_validated eq 1'>{{$list['user_name']}}<else/>
                                未实名认证
                            </if>
                        </td>
                        <td>{{$list['user_phone']}}</td>
                        <td><span  <if condition="$list['user_balance'] lt 0">style="color:red"</if>>￥{{$list['user_balance']}}</span></td>
                        <td><span  <if condition="$list['invest_money'] lt 0">style="color:red"</if>>￥{{$list['invest_money']}}</span></td>
                        <td><span  <if condition="$list['earn_money'] lt 0">style="color:red"</if>>￥{{$list['earn_money']}}</span></td>
                        <td><span  <if condition="$list['frozen_money'] lt 0">style="color:red"</if>>￥{{$list['frozen_money']}}</span></td>
                        <td><span  <if condition="$list['experience_money'] lt 0">style="color:red"</if>>￥{{$list['experience_money']}}</span></td>
                        <td>
                            {{:date("Y-m-d H:i:s",$list['reg_time'])}}<br/>
                            <if condition="$list['last_login']">
                                {{:date("Y-m-d H:i:s",$list['last_login'])}}
                                <else/>未登录
                            </if>
                        </td>
                        <td>
                            <if condition="$list['parent_id']">
                                [{{$list['parent_id']}}]{{$list['parent_name']}}
                                <else/>无邀请
                            </if>

                        </td>
                        <td class="td-status">
                            <switch name="list['status']">
                                <case value="1"><span class="label label-warning  radius">启用</span></case>
                                <case value="2"><span class="label label-default radius">禁用</span></case>

                                <default/><span class="label label-danger radius">异常</span>
                            </switch>
                        </td>
                        <td class="td-manage">
                            <if condition="$list['status'] eq 1">
                                <a style="text-decoration:none" onClick="user_stop(this,{{$list['user_id']}})" href="javascript:;" title="">
                                    <i class="Hui-iconfont">&#xe631;</i>
                                </a>
                                <else/>
                                <a style="text-decoration:none" onClick="user_start(this,{{$list['user_id']}})" href="javascript:;" title="启用">
                                    <i class="Hui-iconfont">&#xe615;</i>
                                </a>
                            </if>
                            <a style="text-decoration:none" class="ml-5" href="{{:U('Admin/BalanceLog/BalanceLogList',array('user_id'=>$list['user_id']))}}" title="明细">
                                <i class="Hui-iconfont">&#xe63a;</i>
                            </a>
                            <a style="text-decoration:none" class="ml-5" onClick="do_show('编辑','{{:U('Admin/Users/UsersEdit',array('id'=>$list['user_id'],'p'=>$p))}}',600,400)" href="javascript:;" title="编辑">
                                <i class="Hui-iconfont">&#xe6df;</i>
                            </a>
                            <!--<a title="删除" href="javascript:;" onclick="do_del(this,{{$list['user_id']}})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>-->
                        </td>
                    </tr>
                </foreach>
                <tr>
                    <td scope="col" colspan="60" >
                        <span class="r" >{{$page}}</span>
                    </td>
                </tr>
                <else/>
                <tr><td colspan="60" class="text-center">  暂时还没有内容! </td></tr>
            </notempty>
            </tbody>
        </table>
        </div>
    </form>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__EXTEND__/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="__EXTEND__/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__EXTEND__/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/laypage/1.2/laypage.js"></script>

<script type="text/javascript">

    /*禁用*/
    function user_stop(obj,id){
        layer.confirm('确认要禁用吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……
            $.ajax({
                type: "POST",
                url: "{{:U('Admin/Users/changeStatus')}}",
                data: {
                    method : 'forbiduser',
                    id : id
                },
                timeout:180000,
                dataType: "JSON",
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('操作失败!',{icon: 5,time:1000});
                },
                success: function(data){
                    if(data.status==1==1){
                        $(obj).parents("tr").find(".td-manage").prepend('<a onClick="user_start(this,'+id+')" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
                        $(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">禁用</span>');
                        $(obj).remove();
                        layer.msg(data.info,{icon: 6,time:1000});
                    }else{
                        layer.msg(data.info,{icon: 5,time:1000});
                    }
                }
            });
        });
    }

    /*启用*/
    function user_start(obj,id){
        layer.confirm('确认要启用吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……
            $.ajax({
                type: "POST",
                url: "{{:U('Admin/Users/changeStatus')}}",
                data: {
                    method : 'resumeuser',
                    id : id
                },
                timeout:180000,
                dataType: "JSON",
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('操作失败!',{icon: 5,time:1000});
                },
                success: function(data){
                    if(data.status==1){
                        $(obj).parents("tr").find(".td-manage").prepend('<a onClick="user_stop(this,'+id+')" href="javascript:;" title="禁用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
                        $(obj).parents("tr").find(".td-status").html('<span class="label label-warning radius">启用</span>');
                        $(obj).remove();
                        layer.msg(data.info, {icon: 6,time:1000});
                    }else{
                        layer.msg(data.info,{icon: 5,time:1000});
                    }
                }
            });
        });
    }

    /*删除*/
    function do_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '{{:U("Admin/Users/changeStatus",array("method"=>"deleteGroup"))}}',
                data: {
                    id : id
                },
                dataType: 'json',
                beforeSend:function(){
                    $(obj).hide();
                },
                success: function(data){
                    $(obj).show();
                    if(data.status){
                        $(obj).parents("tr").remove();
                        layer.msg(data.info,{icon:1,time:1000});
                        setTimeout((function() {
                            window.location.href="{{:U('Admin/Users/UsersList',array('p'=>$p))}}";
                        }), 500);
                    }else{
                        layer.msg(data.info,{icon:2,time:1000});
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
    /*批量删除*/
    $("#mutil_del").click(function(){
        layer.confirm('您确定执行批量删除吗？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $("#form-group-del").ajaxSubmit({
                type: 'post',
                url: "{{:U('Admin/Users/changeStatus',array('method'=>'deleteGroup'))}}" ,
                success: function(data){
                    if(data.status){
                        layer.msg(data.info,{icon:1,time:1000});
                        setTimeout((function() {
                            window.location.href="{{:U('Admin/Users/UsersList',array('p'=>$p))}}";
                        }), 1500);
                    }else{
                        layer.msg(data.info,{icon:2,time:1000});
                    }
                },
                error: function(XmlHttpRequest, textStatus, errorThrown){
                    layer.msg('error!',{icon:5,time:1000});
                }
            });
        }, function(){
        });
    });

    function do_full(title,url){
        layer_full(title,url);
    }

    function do_show(title,url,w,h){
        layer_show(title,url,w,h);
    }

</script>
</body>
</html>